{-# OPTIONS -Wall #-}

--------------------------------------------------------------------------------
-- |
-- Module      :  Text.PrettyPrint.HughesPJ.PrettyExpr.Glsl
-- Copyright   :  (c) Stephen Tetley 2012
-- License     :  BSD3
--
-- Maintainer  :  stephen.tetley@gmail.com
-- Stability   :  unstable
-- Portability :  GHC
--
-- Common OpenGL Shading Language operator pretty printers with 
-- associated fixity and associativity.
--
--------------------------------------------------------------------------------

module Text.PrettyPrint.HughesPJ.PrettyExpr.Glsl
  (
  -- * Unparse a DocE
    unparse

  -- * Glsl operators
  -- ** Precedence 12

  , directSelectionU
  , indirectSelectionU
  , postIncrU
  , postDecrU


  ) where

import Text.PrettyPrint.HughesPJ
import Text.PrettyPrint.HughesPJ.PrettyExpr


-- | Run an unparser for C-like language expressions.
-- 
-- Glsl has maximum precedence of 12.
--
-- Note the doc uses reverse ordering.
--
unparse :: DocE -> Doc
unparse = unparser $ makeUnparser 12


--------------------------------------------------------------------------------
-- Precedence 9


-- | Addition operator.
-- 
-- > + (infixl 9)
--
addB                    :: DocE -> DocE -> DocE
addB                    = Binary $ infixL 9 Space "+"

-- | Addition operator.
-- 
-- > + (infixl 9)
--
subtractB               :: DocE -> DocE -> DocE
subtractB               = Binary $ infixL 9 Space "-"

